home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Apple Sales & Market…urce Library 1999 January
/
ARL Jan 99 CD 2.iso
/
Application Library
/
Networking & Communications
/
Portfolio™ 4.0
/
Scripting Extras
/
Background Cataloger.txt
next >
Wrap
Text File
|
1998-09-15
|
3KB
|
78 lines
-- Some basic properties for the cataloger.
-- Enter values in the fPath and catPath variables to have Background Cataloging automatically
-- monitor these paths, or leave them blank to be prompted at start-up.
property fPath : "" -- Path to the folder to monitor
property catPath : "" -- Path to the catalog to add to
property lastMod : date "Monday, January 1, 1900 12:00:00 AM" -- Date the folder was last modified. Start with an arbitrarily old date.
property intvl : 10 -- Interval, in minutes, between checking the folder for changes.
--Upon launch, get the information about what will be monitored.
on run
setup()
end run
-- The idle loop is the center of the process.
--Every intvl seconds, check to see if the folder has changed.
on idle
tell application "Portfolio"
if is cataloging then
return 5 -- If Portfolio is busy cataloging, then wait five seconds and try again
else
tell me
watch()
end tell
end if
end tell
return (intvl * 60)
end idle
---
-- Setup is where the user is prompted for the paths to the catalog and folder.
-- We've included handlers to allow for keeping same values from previous use (dfeather, 8/23/98)
-- Alternately, these values could be hardcoded for unattended launches.
on setup()
if catPath = "" then
set catPath to choose file with prompt "Select the catalog to add to:" of type {"DBSE"}
else
set ddial to (display dialog "Do you want to continue adding to the catalog: “" & catPath & "” " buttons {"Yes", "Select another…"} default button 1)
if button returned of ddial is not "Yes" then
set catPath to choose file with prompt "Select the catalog to add to:" of type {"DBSE"}
end if
end if
if fPath = "" then
set fPath to choose folder with prompt "Select the folder to monitor:"
else
set ddial to (display dialog "Do you want to continue monitoring the folder: “" & fPath & "” " buttons {"Yes", "Select another…"} default button 1)
if button returned of ddial is not "Yes" then
set fPath to choose folder with prompt "Select the folder to monitor:"
end if
end if
set x to text returned of (display dialog "How many minutes between folder checks?" default answer "10")
--if x as real is ((integer) is true) then
set intvl to x
end setup
on watch()
tell application "Finder"
update fPath
set fPath to fPath as alias
set modDate to modification date obsolete of alias (fPath as text)
if modDate > lastMod then
set lastMod to modDate
tell application "Portfolio"
open catPath
catalog alias (fPath as string) to front gallery
end tell
end if
end tell
return
end watch